#define  _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <vector>
#include <string>
using namespace std;


int main()
{
	string str1, str2;
	getline(cin, str1);
	getline(cin, str2);
	vector<vector<int>> v(2, vector<int>(str1.size() + 1));
	int sum = 0;
	int n = str1.size();
	for (int i = 0; i < n; i++)
	{
		if (str1[i] == '#') sum++;
		if (str2[i] == '#') sum++;
	}
	int num = 0;
	int max_1 = 0, max_2 = 0;
	int ret = 0;
	bool flag1 = false, flag2 = false;
	for (int i = 0; i < n; i++)
	{
		if (str1[i] == '#')
		{
			flag1 = true;
			v[0][i + 1] = v[0][i];
			num++;
		}
		if (str1[i] == '.' && flag1)
		{
			v[0][i + 1] = v[0][i] + 1;
		}
		if (str2[i] == '#')
		{
			flag2 = true;
			v[1][i + 1] = v[1][i];
			num++;
		}
		if (str2[i] == '.' && flag2)
		{
			v[1][i + 1] = v[1][i] + 1;
		}
		if (num == sum)
		{
			if (v[0][i + 1] == 0) v[0][i + 1] = 100000000;
			if (v[1][i + 1] == 0) v[1][i + 1] = 100000000;
			ret = min(v[0][i + 1], v[1][i + 1]);
			break;
		}
	}
	cout << ret;
	return 0;
}

/*
.#.............#........
...##.....#............#
*/